package com.cn.dream_order_server.service.impl;

import com.cn.dream_order_server.mapper.OrderOrderMapper;
import com.cn.dream_order_server.pojo.OrderEsPOJO;
import com.cn.dream_order_server.pojo.OrderOrder;
import com.cn.dream_order_server.repository.OrderOrderRepository;
import com.cn.dream_order_server.service.EsServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class EsServerImpl implements EsServer {

    @Autowired
    private OrderOrderRepository orderOrderRepository;

    @Autowired
    private ElasticsearchTemplate elasticsearchTemplate;

    @Autowired
    private OrderOrderMapper orderOrderMapper;

    @Override
    public void savaEs() {
        List<OrderOrder> list = orderOrderMapper.selectByExample(null);
        orderOrderRepository.saveAll(list);
    }
}
